Skip to content

DRAFT perf(ast): separate metadata from four-byte node parents - #1013

Open
camc314 wants to merge 1 commit into
oxc-project:mainfrom
camc314:codex/ast-header-fields
Open

camc314 wants to merge 1 commit into
oxc-project:mainfrom
camc314:codex/ast-header-fields

Conversation

@camc314

@camc314 camc314 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Store immutable kind and data-tag fields beside four-byte parent handles, avoiding packed-field decoding and parent read/modify/write operations. Eight-byte pointers retain the existing packed representation. Select the layout at compile time from pointer width, including plain-ptrs and 32-bit targets. Preserve the eight-byte header, 24-byte node and existing alignment; introduce no new unsafe operations.

Expand the existing integration case to check metadata, parent updates, trailing-comma markers, rare optional-chain fields, node size and alignment.

Existing benchmark evidence from the original commit, before applying it to current main: Apple M2 Max, Rust 1.99.1, identical release builds with fat LTO, one codegen unit, full symbols, no stripping or PGO, TSRS_FAST=1, and Hyperfine 2. Helpers use warmups and alternating pairs: three at one worker, five at default workers, followed by a reversed default batch. Counters cover the complete helper or CLI, excluding Oxlint. Benchmarks were not rerun for this PR.

16-rule helper medians, baseline → candidate. Instructions use one worker; wall time and peak RSS use the reversed default-worker batch:

Project Instructions (billions) Default wall (s) Default peak RSS (MiB)
webpack 14.158 → 13.940 0.240 → 0.244 529.8 → 529.3
vscode 135.641 → 132.944 1.824 → 1.800 2778.2 → 2773.6
mui-docs 34.218 → 35.471 0.863 → 0.847 1303.5 → 1290.8
t3code-server 54.607 → 53.587 1.819 → 1.849 2502.0 → 2490.2

VS Code default-worker instruction reductions repeat with both 16 rules (1.90% / 1.87%) and 61 rules (2.03% / 1.91%). MUI's single-worker helper regresses 3.66% in instructions and 2.97% in wall time; single-worker peak RSS rises 0.74% on vscode and 0.61% on MUI. Default-worker t3code wall changes are mixed: −0.27% / +1.67% with 16 rules and +2.49% / −3.66% with 61.

Compiler-only single-worker medians from a balanced three-way comparison, baseline → selected layout:

Project Instructions (billions) Wall (s) Peak RSS (MiB)
Compiler 1.701 → 1.669 0.145 → 0.143 54.5 → 54.6
Compiler-Unions 2.901 → 2.870 0.209 → 0.208 58.2 → 58.2
webpack 10.565 → 10.417 0.897 → 0.899 296.0 → 297.1
vscode 80.890 → 79.460 7.810 → 7.750 1554.3 → 1563.4
mui-docs 31.246 → 31.202 2.520 → 2.557 689.2 → 689.3
t3code-server 39.081 → 39.090 3.396 → 3.395 713.0 → 715.0

The selected layout reduces instructions more consistently than the smaller packed-byte alternative in the same compiler cohort. Wall time and memory are mixed; these six public projects are the measured catalog subset.

Scoped Clippy passed with default and plain pointers, and formatting passed. Tests were not run for this PR, as requested.

Copilot AI balanced review requested due to automatic review settings November 17, 2026 12:18
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T12:23:29.418776Z 6fe9dc3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6fe9dc3bf8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

impl NodeHeaderLayout for [(); 4] {
type Header = HandleNodeHeader;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Complete the catalog benchmarks before selecting the new layout

This makes the new layout unconditional for four-byte handles, but the commit supplies only historical measurements covering six of the 19 projects in bench/projects.json and explicitly says they were not rerun against the current base. AGENTS.md requires reporting results across the catalog, including regressions and tradeoffs; the supplied subset does not satisfy that requirement. Before landing this default switch, run and report paired parent-versus-candidate single-threaded instruction counts and default-checker peak RSS across the catalog using matching build settings and workloads.

AGENTS.md reference: AGENTS.md:L59-L60

Useful? React with 👍 / 👎.

@camc314 camc314 changed the title perf(ast): separate metadata from four-byte node parents DRAFT perf(ast): separate metadata from four-byte node parents Nov 17, 2026
@codspeed

codspeed Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 8 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing camc314:codex/ast-header-fields (6fe9dc3) with main (b26fe50)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants